﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TYThreadParser
{
    public class ThreadProcessor
    {
        #region  --- 私有成员 ---

        private WebBrowser wb = null;

        #endregion

        #region  --- 属性 ---

        /// <summary>
        /// 当前URL
        /// </summary>
        public string CurrentUrl { get; private set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        public int CurrentPageNumber { get; private set; }

        #endregion

        #region  --- 构造函数 ---

        public ThreadProcessor(WebBrowser wb)
        {
            this.wb = wb;
            this.wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
            this.wb.Navigated += new WebBrowserNavigatedEventHandler(wb_Navigated);

        }

        #endregion

        #region  --- 公共方法 ---

        public void GetThreadInfo(string threadUrl)
        {
            this.wb.Navigate(threadUrl);
        }

      

        public void SavePages(int startPageNumber, int endPageNumber)
        {
            this.wb.ShowSaveAsDialog();
        }

        #endregion

        #region  --- 私有方法 ---

        void wb_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            
        }

        void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            //throw new NotImplementedException();
            
        }

        #endregion
    }
}
